<style>
    body {
        font-family: opensansreg;
        background: #fff; 
        font-family: opensansreg;
        padding-top: 0px;
    }
</style>
<div style="width: 850px;">
    <div style="width: 850px;">
        <div class="row">
            <div class="span12"> 
                <div style="margin-bottom: 20px; width: 100%;">
                    <div style="border-radius: 5px; background: #fff; border:1px solid #66bc7d; padding: 10px;">
                        <h5 style="font-size: 20px;margin: 0px;">View Order Details</h5>
                    </div>
                </div>
                <?php $classCourse = PurchaseClassCourse::model()->findAll('purchaseorder_id=' . $orderId) ?>
                <div  style="background:#fff;text-align: center; overflow:hidden; width:100%; border-radius:4px; margin-bottom:20px;">
                    <div style="background:#66bc7d; width:100%;">
                        <div  style="border-right:1px solid #b3debe;width:80px;float: left">
                            <div style="padding:12px;">
                                <h5 style="margin: 0px;color: #fff;font-size: 14px; font-weight: normal;font-style: inherit;">Sr. No</h5>
                            </div>
                        </div>
                        <div style="border-right:1px solid #b3debe;width: 190px;float: left;" >
                            <div style="padding:12px;">
                                <h5 style="margin: 0px;color: #fff;font-size: 14px; font-weight: normal;font-style: inherit;">Workshop / Course</h5>
                            </div>
                        </div>
                        <div style="border-right:1px solid #b3debe;width:12%;float: left">
                            <div style="padding:12px;">
                                <h5 style="margin: 0px;color: #fff;font-size: 14px; font-weight: normal;font-style: inherit;">Quantity</h5>
                            </div>
                        </div>
                        <div style="border-right:1px solid #b3debe;float: left;">
                            <div style="padding:12px;">
                                <h5 style="margin: 0px;color: #fff;font-size: 14px; font-weight: normal;font-style: inherit;width: 90px">Price</h5>
                            </div>
                        </div>
                        <div style="border-right:1px solid #b3debe;float: left;width: 250px;">
                            <div style="padding:12px;">
                                <h5 style="margin: 0px;color: #fff;font-size: 14px; font-weight: normal;font-style: inherit;">Applicable Discount</h5>
                            </div>
                        </div>
                        <div style="border-right:1px solid #b3debe;margin: 0px;">
                            <div  style="padding:12px;">
                                <h5 style="margin: 0px;color: #fff;font-size: 14px; font-weight: normal;font-style: inherit;">Total Price</h5>
                            </div>
                        </div>
                        <div style="clear: both"></div>
                    </div>

                    <?php
                    $i = 1;
                    foreach ($classCourse as $classCourse) {
                        $earlyDscount = '';
                        $groupDscount = '';
                        if (!empty($classCourse->classes_id)) {
                            $className = getClassName($classCourse->classes_id);

                            $batchId = $classCourse->class_batch_id;
                            $imagePath = getImagePathByClassCourse('Classes', $classCourse->classes_id);
                            $imageName = (ClassImage::getPrimaryImage($classCourse->classes_id) != '') ? baseUrl() . '../../' . SkillConfig::getClassCourseImagePath($imagePath) . '240X180/' . ClassImage::getPrimaryImage($classCourse->classes_id) : baseUrl() . '../../' . getUploadDir() . '/no-class-image.jpg';
                        } else {
                            $batchId = $classCourse->course_batch_id;
                            $className = getcourseName($classCourse->courses_id);
                            $imagePath = getImagePathByClassCourse('Courses', $classCourse->courses_id);
                            $imageName = (ClassImage::getPrimaryImage($classCourse->courses_id) != '') ? baseUrl() . '../../' . SkillConfig::getClassCourseImagePath($imagePath) . '240X180/' . ClassImage::getCoursesPrimaryImage($classCourse->courses_id) : baseUrl() . '../../' . getUploadDir() . '/no-class-image.jpg';
                        }
                        $imageName = 'http://' . Yii::app()->request->serverName . $imageName;
                        $imageName = '<img class="cartProduct" src="' . $imageName . '" alt="' . $className . '"  style="width:150px;" />';
                        $earlyDscount = ClassBatch::getearlyDscountByBatch($batchId, $classCourse->batch_seats);
                        $groupDscount = ClassBatch::getgroupDscountByBatch($batchId, $classCourse->batch_seats);
                        $totalPrice = ($classCourse->batch_price * $classCourse->batch_seats) - ($earlyDscount + $groupDscount);
                        ?>

                        <div style="border-bottom:1px solid#ccc;">
                            <div style="width:80px;float: left">
                                <div style="padding: 12px;">
                                    <p style="font-size: 14px;margin-bottom: 0px!important;display: inline-block;"><?php echo $i; ?> .</p>
                                </div>
                            </div>                                                               
                            <div style="width: 190px;float: left;">
                                <div style="padding: 12px;">
                                    <div style="width:100%;">
                                        <div style="float:left; margin-right:2%;"><?php echo $imageName; ?></div>
                                        <div style="margin-right:2%"><p style="font-size: 14px;display:inline-block;"><?php echo $className; ?></p></div>
                                        <div style="clear:both;"></div>
                                    </div>
                                </div>
                            </div>
                            <div style="width:12%;float: left">
                                <div style="padding: 12px;">
                                    <p style="font-size: 14px;color: #000;font-family: opensansbd;"><?php echo $classCourse->batch_seats; ?></p>
                                </div>
                            </div>
                            <div style="width:90px;float: left">
                                <div style="padding: 12px;">
                                    <p style="font-size: 14px;color: #000;font-family: opensansbd;"><?php echo $classCourse->batch_price; ?></p>
                                </div>
                            </div>
                            <div style="float: left;width: 250px;">
                                <div style="padding: 12px;">
                                    <p style="font-size: 14px;color: #000;font-family: opensansbd;"><h5 style="margin: 0px;color: #000;font-size: 14px; font-weight: normal;font-style: inherit;"><?php echo!empty($earlyDscount) ? ' Early Discount Rs : ' . $earlyDscount : '---' ?></h5>
                                    <h5 style="margin: 0px;color: #000;font-size: 14px; font-weight: normal;font-style: inherit;"> <?php echo!empty($groupDscount) ? 'Group Discount Rs : ' . $groupDscount : '---' ?></h5></p>
                                </div>
                            </div>
                            <div>
                                <div style="padding: 12px;">
                                    <p style="font-size: 14px;color: #000;font-family: opensansbd;margin-bottom: 0px!important;"><?php echo $totalPrice; ?></p>
                                </div>
                            </div>
                            <div style="clear:both"></div>
                        </div>
                        <?php
                    }
                    $total_discount_for_mail = (Yii::app()->user->hasState('total_discount_for_mail')) ? Yii::app()->user->getState('total_discount_for_mail') : '';
                    if (!empty($total_discount_for_mail)) {
                        ?>
                        <div style="border-bottom:1px solid#ccc;">
                            <div style="width:80px;float: left">
                                <div style="padding: 20px;">
                                    <h5 style="margin: 0px;color: #fff;font-size: 14px; font-weight: normal;font-style: inherit;"></h5>
                                </div>
                            </div>
                            <div style="width: 190px;float: left;">
                                <div style="padding: 20px;">
                                    <h5 style="margin: 0px;color: #fff;font-size: 14px; font-weight: normal;font-style: inherit;"></h5>
                                </div>
                            </div>
                            <div style="width:12%;float: left">
                                <div style="padding: 20px;">
                                    <h5 style="margin: 0px;color: #fff;font-size: 14px; font-weight: normal;font-style: inherit;"></h5>
                                </div>
                            </div>
                            <div style="float: left;">
                                <div style="padding: 20px;">
                                    <h5 style="margin: 0px;color: #fff;font-size: 14px; font-weight: normal;font-style: inherit;"></h5>
                                </div>
                            </div>
                            <div style="float: left;width: 280px;">
                                <div style="padding: 20px;">
                                    <h5 style="margin: 0px;color: #000;font-size: 14px; font-weight: normal;font-style: inherit;">Discount Price</h5>
                                </div>
                            </div>
                            <div style="float: left;">
                                <div style="padding: 20px;">
                                    <h5 style="margin: 0px;color: #000;font-size: 14px; font-weight: normal;font-style: inherit;"><?php echo number_format($total_discount_for_mail, 2); ?></h5>
                                </div>
                            </div>
                            <div style="clear:both"></div>
                        </div>
                        <div style="border-bottom:1px solid#ccc;">
                            <div style="width:80px;float: left">
                                <div style="padding: 20px;">
                                    <h5 style="margin: 0px;color: #fff;font-size: 14px; font-weight: normal;font-style: inherit;">Coupon code</h5>
                                </div>
                            </div>

                            <div style="float: left">
                                <div style="padding: 20px;">
                                    <h5 style="margin: 0px;color: #fff;font-size: 14px; font-weight: normal;font-style: inherit;"><?php echo (Yii::app()->user->hasState('appliedcoupon')) ? Yii::app()->user->getState('appliedcoupon') : ''; ?></h5>
                                </div>
                            </div>

                            <div style="clear:both"></div>
                        </div>
                    <?php } ?>
                    <div style="border-bottom:1px solid#ccc;">
                        <div style="width:80px;float: left">
                            <div style="padding: 20px;">
                                <h5 style="margin: 0px;color: #fff;font-size: 14px; font-weight: normal;font-style: inherit;"></h5>
                            </div>
                        </div>
                        <div style="width: 190px;float: left;">
                            <div style="padding: 20px;">
                                <h5 style="margin: 0px;color: #fff;font-size: 14px; font-weight: normal;font-style: inherit;"></h5>
                            </div>
                        </div>
                        <div style="width:12%;float: left">
                            <div style="padding: 20px;">
                                <h5 style="margin: 0px;color: #fff;font-size: 14px; font-weight: normal;font-style: inherit;"></h5>
                            </div>
                        </div>
                        <div style="float: left;">
                            <div style="padding: 20px;">
                                <h5 style="margin: 0px;color: #fff;font-size: 14px; font-weight: normal;font-style: inherit;"></h5>
                            </div>
                        </div>
                        <div style="float: left;width: 280px;">
                            <div style="padding: 20px;">
                                <h5 style="margin: 0px;color: #000;font-size: 14px; font-weight: normal;font-style: inherit;">Total Price</h5>
                            </div>
                        </div>
                        <div style="float: left;">
                            <div style="padding: 20px;">
                                <h5 style="margin: 0px;color: #000;font-size: 14px; font-weight: normal;font-style: inherit;"><?php echo number_format($totalCost, 2); ?></h5>
                            </div>
                        </div>
                        <div style="clear:both"></div>
                    </div>
                </div>
            </div>
        </div> </div>
</div>
